package com.gfxy;

import com.gfxy.commons.spring.SpringContextHolder;
import com.gfxy.educational.service.QuartzService;
import org.mybatis.spring.annotation.MapperScan;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.context.annotation.Bean;

/**
 * @author: lijixin 2019-04-30
 */
@SpringBootApplication
@MapperScan({"com.gfxy.common.portal.dao","com.gfxy.educational.dao"})
public class PortalBootApplication {

    public static void main(String[] args) throws SchedulerException {
        SpringApplication.run(PortalBootApplication.class, args);
        QuartzService quartzService = SpringContextHolder.getBean("quartzService");
        quartzService.initPushJob();
        Scheduler scheduler = SpringContextHolder.getBean("scheduler");
        scheduler.start();

    }

    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return container -> {
            container.setSessionTimeout(8*60*60);/*单位为S*///设置session超时时间为8小时
        };
    }

}

